import { MockMethod } from 'vite-plugin-mock';
import Mock from 'mockjs';

const mock: MockMethod[] = [
  {
    url: '/api/article',
    method: 'get',
    timeout: Math.floor(Math.random() * 2000 + 500),
    response: () => {
      return {
        code: 200,
        message: '登录成功',
        type: 'success',
        data: new Array(20).fill({}).map((article, index) => {
          return {
            id: index,
            title: Mock.Random.ctitle(),
            author: Mock.Random.cname(),
            content: Mock.Random.cparagraph(),
          };
        }),
      };
    },
  },
];

export default mock;
